from apis.wework import WeWork


class Member(WeWork):
    def __init__(self):
        super().__init__()

    # 创建成员
    def create_member(self):
        pass

    # 读取成员
    def get_member(self):
        pass

    # 更新成员
    def update_member(self):
        pass

    # 删除成员
    def delete_member(self):
        pass

    # 批量删除成员
    def batch_delete_member(self):
        pass

    # 获取部门成员
    def get_depart_member(self, Id, fetch_child=None):
        '''
        :param Id: 必填，获取的部门id
        :param fetch_child:非必填，是否递归获取子部门下面的成员：1-递归获取，0-只获取本部门
        :return:{"errcode": 0,"errmsg": "ok","userlist": [{"userid": "zhangsan","name": "张三","department": [1, 2],"open_userid": "xxxxxx"}]}
        '''
        data = {
            "method": "GET",
            "url": f"https://qyapi.weixin.qq.com/cgi-bin/user/simplelist?access_token={self.token}",
            "params": {
                "department_id": Id,
                "fetch_child": fetch_child
            }
        }
        return self.send(**data)

    # 获取部门成员详情
    def get_departmember_detail(self):
        pass